<template>
    <div v-if="Object.keys(goods).length !== 0"
         class="base-info">
        <div class="info-title">{{goods.title}}</div>
        <div class="info-price">
            <span class="n-price">{{"¥"+goods.lowNowPrice}}</span>
            <span class="o-price">{{goods.oldPrice}}</span>
            <span v-if="goods.discount"
                  :style="{backgroundColor:goods.discountBgColor}"
                  class="discount">{{goods.discount}}</span>
        </div>
        <div class="info-other">
            <span>{{goods.columns[0]}}</span>
            <span>{{goods.columns[1]}}</span>
            <span>{{goods.services[goods.services.length-1].name}}</span>
        </div>
        <div class="info-service">
            <span class="info-service-item"
                  v-for="index in (goods.services.length>3?3:goods.services.length)"
                  :key="index">
                <img :src="goods.services[index-1].icon">
                <span>{{goods.services[index-1].name}}</span>
            </span>
        </div>

    </div>
</template>
<script>
export default {
    name: 'DetailBaseInfo',
    props: {
        goods: {
            type: Object,
            default () {
                return {}
            }
        }
    },
}
</script>
<style scoped>
.base-info {
    font-size: 14px;
}
.info-title {
    padding: 5px;
    font-weight: bold;
    background-color: #fff;
}
.info-price {
    padding: 5px;
    display: flex;
    align-items: center;
    background-color: #fff;
}
.n-price {
    font-size: 20px;
    color: var(--color-high-text);
}
.o-price {
    text-decoration: line-through;
    color: gray;
    padding-left: 10px;
}
.discount {
    font-size: 10px;
    padding: 3px 8px;
    color: #fff;
    border-radius: 5px;
    margin-left: 10px;
}
.info-other {
    display: flex;
    color: #999;
    padding: 10px 4px;
    border-bottom: 1px solid #eee;
    border-top: 1px solid #eee;
    background-color: #fff;
    margin-top: 10px;
}

.info-other > span {
    display: inline-block;
    flex: 1;
    text-align: center;
}
.info-service {
    display: flex;
    background-color: #fff;
    margin-top: 10px;
    padding: 10px 4px;
}
.info-service-item {
    text-align: center;
    flex: 1;
}
.info-service-item img {
    vertical-align: middle;
    height: 18px;
    padding-right: 2px;
}
.info-service-item span {
    vertical-align: middle;
}
</style>